Repository navigation
Conversation
…holds A host that paces a keyed pan sends at most one move a display frame, and none while the last is unanswered. newestOnly answers the newest move once the ones already delivered have been read, so a slow worker answers where the finger is now instead of working through a backlog. The scratch card and the worker slider both answer their moves through it.
This was referenced Nov 24, 2026
…s gesture and mask The worker draws the ticket itself through the renderer: a keyed Gesture whose pan reports the finger's location, over the prize and the foil. The foil sits in a Box carrying a Mask that hides it where the finger went. The mask follows the pan, so the host draws each stroke as a 52-point line with round ends in the frame of the touch, and a lone press leaves a dot. The host paces the pan's moves, and the worker answers only the newest one it holds with an empty ExtendMask, never a tree. It keeps the points it hears, so a tree that redraws the ticket keeps the strokes. The mask names a cleared share of 550 thousandths with the action dds.reveal: the host sends it when the strokes clear 55% of the foil with the finger up, and a tree without the foil shows the prize, then the result card. The worker keeps no threshold of its own and ignores a repeat. The ticket takes the existing Daily Dollar ticket's size and pictures on the platform the host reports (iOS 290 x 380, Android 309 x 400). Its outcome and claim are stand-ins, and only a DD_SCRATCH=worker build posts it.
HadiKhai
force-pushed
the
feat/jollity-worker-scratch-card
branch
from
November 24, 2026 11:24
829bd2a to
20ef2d7
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it does
The Jollity worker draws a Daily Dollar scratch card itself, on the host's renderer:
Gesturewhose pan reports where the finger is, over the prize and the foil. The foil sits in aBoxthat carries aMaskhiding it where the finger went. The card is built from general nodes only, so a foil drawn by another kind of node can take the picture's place under the same mask.ExtendMask, a few bytes each way and never a tree. It keeps the points it hears, so a tree that redraws the ticket (after a scroll, say) keeps the strokes.dds.reveal. The host sends it when the strokes clear 55% of the foil with the finger up. A tree without the foil then shows the prize, then the result card. The worker keeps no threshold of its own and ignores a repeat.The first commit adds
newestOnly(src/newest-only.ts), which answers only the newest gesture move. The worker slider draft uses it too and carries the same commit, so whichever of the two lands second drops it on rebase.How it looks
On an iPhone simulator: a slow stroke, a fast stroke and a lone-press dot clear the foil under the finger, then strokes across until the foil goes on a lift and the prize shows, then the result card. The pauses between touches are shortened, and the reveal and the result play at real speed. The small blue circles are the simulator showing where the finger is.
scratch-card-dot-strokes-and-result-iphone.mp4
The same worker on an Android emulator, with the same touches.
scratch-card-dot-strokes-and-result-android.mp4
How it was tested
followandclearedShare), the emptyExtendMaskanswers, the reveal only on the host's action, a repeat reveal ignored, the redraw of a half-scratched ticket with its strokes and dot, and the platform looks.hostStack.test.tsmoves only with a truapi release. A chain reading test and the hung poll test time out on a heavily loaded machine and pass when run again.src/host.ts:registerRoompasses aroomIdthat the newer chat request type no longer has. It comes from the chat API on trinity-user-agentsmain, not from the card.What it needs from trinity-user-agents
It needs renderer pieces that no truapi release carries yet: the generic
Gesturenode with its event payload (positions in hundredths of a logical pixel), theMaskmodifier withfollowandclearedShare, and theExtendMaskupdate. The paired draft pull requests on paritytech/trinity-user-agents are in progress.Checks that can't pass yet
The worker pins the published
@parity/truapiat^0.32.0, which has none of those pieces. So the Jollity and Previewnet checks stay red until a truapi release carries the gesture and mask nodes: typecheck fails on the new exports (extendMask,maskStroke,decodeGestureEvent, theGesturenode and theMaskmodifier), and the scratch card tests fail for the same reason. The schema pin inhostStack.test.tsmoves with the truapi bump that brings them.What's not done
DD_SCRATCH=workerbuild posts the card (seeapps/jollity-worker/README.md). The default build posts none.src/index.tsis also changed by #51 in other places. The two merge cleanly, and whichever lands second rebases.